<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/date_time/c_time.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/date_time</a> - c_time.hpp<span style="font-size: 80%;"> (source / <a href="c_time.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">4</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntryMed">80.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef DATE_TIME_C_TIME_HPP___</a>
<span class="lineNum">       2 </span>            : #define DATE_TIME_C_TIME_HPP___
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
<span class="lineNum">       5 </span>            :  * Use, modification and distribution is subject to the
<span class="lineNum">       6 </span>            :  * Boost Software License, Version 1.0. (See accompanying
<span class="lineNum">       7 </span>            :  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       8 </span>            :  * Author: Jeff Garland, Bart Garst
<span class="lineNum">       9 </span>            :  * $Date$
<span class="lineNum">      10 </span>            :  */
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : /*! @file c_time.hpp
<span class="lineNum">      14 </span>            :   Provide workarounds related to the ctime header
<span class="lineNum">      15 </span>            : */
<span class="lineNum">      16 </span>            : 
<span class="lineNum">      17 </span>            : #include &lt;ctime&gt;
<span class="lineNum">      18 </span>            : #include &lt;string&gt; // to be able to convert from string literals to exceptions
<span class="lineNum">      19 </span>            : #include &lt;stdexcept&gt;
<span class="lineNum">      20 </span>            : #include &lt;boost/throw_exception.hpp&gt;
<span class="lineNum">      21 </span>            : #include &lt;boost/date_time/compiler_config.hpp&gt;
<span class="lineNum">      22 </span>            : 
<span class="lineNum">      23 </span>            : //Work around libraries that don't put time_t and time in namespace std
<span class="lineNum">      24 </span>            : #ifdef BOOST_NO_STDC_NAMESPACE
<span class="lineNum">      25 </span>            : namespace std { using ::time_t; using ::time; using ::localtime;
<span class="lineNum">      26 </span>            :                 using ::tm;  using ::gmtime; }
<span class="lineNum">      27 </span>            : #endif // BOOST_NO_STDC_NAMESPACE
<span class="lineNum">      28 </span>            : 
<span class="lineNum">      29 </span>            : //The following is used to support high precision time clocks
<span class="lineNum">      30 </span>            : #ifdef BOOST_HAS_GETTIMEOFDAY
<span class="lineNum">      31 </span>            : #include &lt;sys/time.h&gt;
<span class="lineNum">      32 </span>            : #endif
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span>            : #ifdef BOOST_HAS_FTIME
<span class="lineNum">      35 </span>            : #include &lt;time.h&gt;
<span class="lineNum">      36 </span>            : #endif
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            : namespace boost {
<span class="lineNum">      39 </span>            : namespace date_time {
<span class="lineNum">      40 </span>            :   //! Provides a uniform interface to some 'ctime' functions
<span class="lineNum">      41 </span>            :   /*! Provides a uniform interface to some ctime functions and
<span class="lineNum">      42 </span>            :    * their '_r' counterparts. The '_r' functions require a pointer to a
<span class="lineNum">      43 </span>            :    * user created std::tm struct whereas the regular functions use a
<span class="lineNum">      44 </span>            :    * staticly created struct and return a pointer to that. These wrapper
<span class="lineNum">      45 </span>            :    * functions require the user to create a std::tm struct and send in a
<span class="lineNum">      46 </span>            :    * pointer to it. This struct may be used to store the resulting time.
<span class="lineNum">      47 </span>            :    * The returned pointer may or may not point to this struct, however,
<span class="lineNum">      48 </span>            :    * it will point to the result of the corresponding function.
<span class="lineNum">      49 </span>            :    * All functions do proper checking of the C function results and throw
<span class="lineNum">      50 </span>            :    * exceptions on error. Therefore the functions will never return NULL.
<span class="lineNum">      51 </span>            :    */
<span class="lineNum">      52 </span>            :   struct c_time {
<span class="lineNum">      53 </span>            :     public:
<span class="lineNum">      54 </span>            : #if defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS)
<a name="55"><span class="lineNum">      55 </span>            :       //! requires a pointer to a user created std::tm struct</a>
<span class="lineNum">      56 </span>            :       inline
<span class="lineNum">      57 </span><span class="lineCov">      41406 :       static std::tm* localtime(const std::time_t* t, std::tm* result)</span>
<span class="lineNum">      58 </span>            :       {
<span class="lineNum">      59 </span>            :         // localtime_r() not in namespace std???
<span class="lineNum">      60 </span>            :         #if defined(__VMS) &amp;&amp; __INITIAL_POINTER_SIZE == 64
<span class="lineNum">      61 </span>            :         std::tm tmp;
<span class="lineNum">      62 </span>            :         if(!localtime_r(t,&amp;tmp))
<span class="lineNum">      63 </span>            :             result = 0;
<span class="lineNum">      64 </span>            :         else
<span class="lineNum">      65 </span>            :             *result = tmp;      
<span class="lineNum">      66 </span>            :         #else
<span class="lineNum">      67 </span><span class="lineCov">      41406 :         result = localtime_r(t, result);</span>
<span class="lineNum">      68 </span>            :         #endif
<span class="lineNum">      69 </span><span class="lineCov">      41406 :         if (!result)</span>
<span class="lineNum">      70 </span><span class="lineNoCov">          0 :           boost::throw_exception(std::runtime_error(&quot;could not convert calendar time to local time&quot;));</span>
<span class="lineNum">      71 </span><span class="lineCov">      41406 :         return result;</span>
<span class="lineNum">      72 </span>            :       }
<span class="lineNum">      73 </span>            :       //! requires a pointer to a user created std::tm struct
<span class="lineNum">      74 </span>            :       inline
<span class="lineNum">      75 </span>            :       static std::tm* gmtime(const std::time_t* t, std::tm* result)
<span class="lineNum">      76 </span>            :       {
<span class="lineNum">      77 </span>            :         // gmtime_r() not in namespace std???
<span class="lineNum">      78 </span>            :         #if defined(__VMS) &amp;&amp; __INITIAL_POINTER_SIZE == 64
<span class="lineNum">      79 </span>            :         std::tm tmp;
<span class="lineNum">      80 </span>            :         if(!gmtime_r(t,&amp;tmp))
<span class="lineNum">      81 </span>            :           result = 0;
<span class="lineNum">      82 </span>            :         else
<span class="lineNum">      83 </span>            :           *result = tmp;        
<span class="lineNum">      84 </span>            :         #else
<span class="lineNum">      85 </span>            :         result = gmtime_r(t, result);
<span class="lineNum">      86 </span>            :         #endif
<span class="lineNum">      87 </span>            :         if (!result)
<span class="lineNum">      88 </span>            :           boost::throw_exception(std::runtime_error(&quot;could not convert calendar time to UTC time&quot;));
<span class="lineNum">      89 </span>            :         return result;
<span class="lineNum">      90 </span>            :       }
<span class="lineNum">      91 </span>            : #else // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
<span class="lineNum">      92 </span>            : 
<span class="lineNum">      93 </span>            : #if (defined(_MSC_VER) &amp;&amp; (_MSC_VER &gt;= 1400))
<span class="lineNum">      94 </span>            : #pragma warning(push) // preserve warning settings
<span class="lineNum">      95 </span>            : #pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8
<span class="lineNum">      96 </span>            : #endif // _MSC_VER &gt;= 1400
<span class="lineNum">      97 </span>            :       //! requires a pointer to a user created std::tm struct
<span class="lineNum">      98 </span>            :       inline
<span class="lineNum">      99 </span>            :       static std::tm* localtime(const std::time_t* t, std::tm* result)
<span class="lineNum">     100 </span>            :       {
<span class="lineNum">     101 </span>            :         result = std::localtime(t);
<span class="lineNum">     102 </span>            :         if (!result)
<span class="lineNum">     103 </span>            :           boost::throw_exception(std::runtime_error(&quot;could not convert calendar time to local time&quot;));
<span class="lineNum">     104 </span>            :         return result;
<span class="lineNum">     105 </span>            :       }
<span class="lineNum">     106 </span>            :       //! requires a pointer to a user created std::tm struct
<span class="lineNum">     107 </span>            :       inline
<span class="lineNum">     108 </span>            :       static std::tm* gmtime(const std::time_t* t, std::tm* result)
<span class="lineNum">     109 </span>            :       {
<span class="lineNum">     110 </span>            :         result = std::gmtime(t);
<span class="lineNum">     111 </span>            :         if (!result)
<span class="lineNum">     112 </span>            :           boost::throw_exception(std::runtime_error(&quot;could not convert calendar time to UTC time&quot;));
<span class="lineNum">     113 </span>            :         return result;
<span class="lineNum">     114 </span>            :       }
<span class="lineNum">     115 </span>            : #if (defined(_MSC_VER) &amp;&amp; (_MSC_VER &gt;= 1400))
<span class="lineNum">     116 </span>            : #pragma warning(pop) // restore warnings to previous state
<span class="lineNum">     117 </span>            : #endif // _MSC_VER &gt;= 1400
<span class="lineNum">     118 </span>            : 
<span class="lineNum">     119 </span>            : #endif // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
<span class="lineNum">     120 </span>            :   };
<span class="lineNum">     121 </span>            : }} // namespaces
<span class="lineNum">     122 </span>            : 
<span class="lineNum">     123 </span>            : #endif // DATE_TIME_C_TIME_HPP___
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
